//
//  HYCPudPushCell.m
//  FamilyTravel
//
//  Created by dllo on 15/10/30.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "HYCPudPushCell.h"
#import "HYCHeadDocument.h"
#define WIDTH self.contentView.frame.size.width
#define HEIFGT self.contentView.frame.size.height
@implementation HYCPudPushCell

- (void)dealloc {
    [_addLabel release];
    [_moneylabel release];
    [_starLabel release];
    [_enLabel release];
    [_cnLabel release];
    [_moneylabel release];
    [_tuImageView release];
    
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    
    return self;
}

- (void)createCell {
    
    self.tuImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.tuImageView];
    [_tuImageView release];

    
    
    self.markLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.markLabel];
    [_markLabel release];
    self.markLabel.textAlignment = NSTextAlignmentCenter;
    self.markLabel.font = [UIFont systemFontOfSize:12];
    
    self.cnLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.cnLabel];
    [_cnLabel release];
    self.cnLabel.textAlignment = NSTextAlignmentCenter;
    self.cnLabel.font = [UIFont systemFontOfSize:12];

    
    self.enLabel =[[UILabel alloc]init];
    [self.contentView addSubview:self.enLabel];
    [_enLabel release];
    self.enLabel.textAlignment = NSTextAlignmentCenter;
    self.enLabel.font = [UIFont systemFontOfSize:12];

    
    self.starLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.starLabel];
    [_starLabel release];
    self.starLabel.textAlignment = NSTextAlignmentCenter;
    self.starLabel.font = [UIFont systemFontOfSize:12];

    
    self.addLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.addLabel];
    [_addLabel release];
    self.addLabel.font = [UIFont systemFontOfSize:12];

    
    
    self.moneylabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.moneylabel];
    [_markLabel release];
    self.moneylabel.textAlignment = NSTextAlignmentCenter;
    self.moneylabel.font = [UIFont systemFontOfSize:12];
    
    
    
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.tuImageView.frame = CGRectMake(WIDTH / (WIDTH / 5), HEIFGT / (HEIFGT / 5), WIDTH / 3, HEIFGT - 10);
    self.cnLabel.frame = CGRectMake(WIDTH / 3 + 10, HEIFGT / (HEIFGT / 5), WIDTH / 2.5, HEIFGT / 6);
    self.enLabel.frame =CGRectMake(WIDTH / 3 + 10, HEIFGT / 6 + 8, WIDTH / 2.5, HEIFGT / 6);
    self.markLabel.frame = CGRectMake(WIDTH / 5 * 4, 5, WIDTH / 5, HEIFGT / 6);
    self.starLabel.frame = CGRectMake(WIDTH / 3 + 10, HEIFGT / 2, WIDTH / 7, HEIFGT / 6);
    self.addLabel.frame = CGRectMake(WIDTH / 3 + 10, HEIFGT / 5 * 4, WIDTH / 3, HEIFGT / 6);
    self.moneylabel.frame = CGRectMake(WIDTH / 4 * 3, HEIFGT / 5 * 4, WIDTH / 4 - 5, HEIFGT / 6);
 
}

- (void)setModel:(HYCPudPushModel *)model {
    
    if (self.model != model) {
        [_model release];
        _model = [model retain];
    
        self.cnLabel.text = _model.cnname;
        self.enLabel.text = _model.enname;
        self.starLabel.text = _model.star;
        self.addLabel.text = _model.area_name;
        CGFloat num = [_model.ranking doubleValue];
        NSString *str = [NSString stringWithFormat:@"%.1f%@", num, @"分"];
        self.markLabel.text = str;
        
        NSString *wStr = [NSString stringWithFormat:@"%@%@", _model.price, @"元起"];
        self.moneylabel.text = wStr;
        
        [self.tuImageView sd_setImageWithURL:[NSURL URLWithString:_model.photo]placeholderImage:[UIImage imageNamed:@"zw.png"]];
        
        
        
    }
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
